<?php
/**
 * Created by PhpStorm.
 * FileName: Push.php
 * User: Administrator
 * Date: 2018/7/24
 * Time: 9:03
 */

namespace app\worker\controller;

use GatewayClient\Gateway;

/**
 * 客户端使用示例
 * Class Push
 * @package app\gatewayapp\controller
 */
class Push
{

    public function __construct()
    {

    }

    public function sendToAll()
    {
        $data = '请不要发布暴力新闻！';
        Gateway::sendToAll($data);
    }

    public function sendToClient()
    {
        $client_id = '7f0000010b5400000001';
        $data = '请不要发布暴力新闻！';
        //Gateway::bindUid($client_id, '1129');

        Gateway::sendToClient($client_id, $data);
    }

    /**
     * 向所有 uid 发送
     *
     * @param int|string|array $uid
     * @param string $message
     */
    public function sendToUid($uid, $data)
    {
        $data = '请不要发布暴力新闻';
        Gateway::sendToUid($uid, $data);
    }

}